package tech.eyao.hs60x.user.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import tech.eyao.hs60x.annotation.Admin;
import tech.eyao.hs60x.dto.BaseResult;
import tech.eyao.hs60x.service.CommandService;
import tech.eyao.hs60x.utils.TokenUtils;

@RestController
@Api("系统指令消息相关")
@RequestMapping("/command")
public class CommandController {
	@Autowired
	private CommandService commandService;

    @PostMapping("/getMessageList.do")
    @ApiOperation("手表消息列表")
    public BaseResult getMessageList(@ApiParam("手表Id") long watchId, @ApiParam("当前页") int pageNo,
                                             @ApiParam("每页页数") int pageSize) {
        return null;
    }

    //远程关机 远程重启 远程监听 查找设备
    @Admin
    @ApiOperation("发送消息")
    @PostMapping("/sendCommand.do")
    public BaseResult sendCommand(@ApiParam("操作码 int")int code, @ApiParam("手表ID long")long watchId, @ApiParam(value="数据 json Sting")String data) {
        return commandService.sendCommand(TokenUtils.getUserId(), code, watchId, data);
    }
    
    
    @ApiOperation("发送通知")
    @PostMapping("/notification.do")
    public BaseResult notification(@ApiParam("操作码 int")int code, @ApiParam("手表ID long")long watchId, @ApiParam("数据 json String")String data) {
        return commandService.notification(TokenUtils.getUserId(), code, watchId, data);
    }
}
